# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-fiona
pkgver=1.9.6
pkgrel=1
pkgdesc="Fiona reads and writes geographical data files"
url="https://github.com/Toblerity/Fiona"
arch="all"
license="BSD-3-Clause"
depends="
	cython
	gdal
	gdal-dev
	python3
	python3-dev
	py3-attrs
	py3-click-plugins
	py3-cligj
	py3-certifi
	py3-munch
	py3-setuptools
	py3-six
	py3-tz
	"
checkdepends="py3-pytest py3-pytest-cov py3-boto3"
makedepends="py3-gpep517 py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/f/fiona/fiona-$pkgver.tar.gz
	patch-vendor.patch
	"
builddir="$srcdir/fiona-$pkgver"

prepare() {
	default_prepare
	rm -r fiona/_vendor
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	mv fiona backup
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -x -m "not wheel"
	mv backup fiona
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	# conflicts with fio package
	mv "$pkgdir"/usr/bin/fio "$pkgdir"/usr/bin/fiona-fio
}

sha512sums="
3d21d733400a3d41f870e22d39ff192e0315ae9c54584acf55cede478c73cac20b5f31f1ea7e0079e3107ae5ce96533a699b811367c72624c5829088e7874894  py3-fiona-1.9.6.tar.gz
0f9daebc982ead978e8e192e988593e2a10745ecba2d44a1f94d994e9fdcd1647de5b71f891c536f681f1a1a8be4fb416e50e27cb762811da333ec915bde4638  patch-vendor.patch
"
